package mail;

import gui.NewMailWindow;

import java.util.LinkedList;

import contacts.Owner;

/**
 * Email Funktionalität wird getestet
 * 
 * @author Michi
 * 
 */
public class Test {

	public static void main(String[] args) {

		Owner test = new Owner("Michael", "Brandt");
		test.setEmail("testmail@brotek.eu");
		test.setImapServer("imap.brotek.eu");
		test.setMailPass("test123");
		test.setSmtpServer("smtp.brotek.eu");
		test.setProvider("imap");

		Owner test1 = new Owner("Michael", "Brandt");
		test1.setEmail("testmailsopra@gmail.com");
		test1.setImapServer("imap.gmail.com");
		test1.setMailPass("sopra1213");
		test1.setSmtpServer("smtp.brotek.eu");
		test1.setProvider("imaps");

		MyModelEmail mme = new MyModelEmail();
		// LinkedList testList = mme.listInbox(test);

		LinkedList<Mail> testList = mme.listInbox();

		// System.out.println(testList.size());
		// mme.deleteMail(test, testList.get(10));
		// System.out.println(testList.size());
		//
		for (int i = 0; i < testList.size(); i++) {
			Mail mail = (Mail) testList.get(i);
			System.out.println(mail.toString());
			System.out.println("");
			System.out.println("");
			System.out.println("");
			System.out.println("");

		}

		//
		// // String[] temp = new String[2];
		// // temp[0] = "testmail.brotek.eu";
		// // temp[1] = "michi.brandt@me.com";
		//
		// Mail mail = new Mail();
		// mail.setFrom(test.getEmail());
		// mail.addRec("testmail@brotek.eu");
		// mail.addRec("michi.brandt@me.com");
		// mail.setBetreff("First Send Test");
		// mail.setText("Hoffentlich klappt alles!");
		//
		// mme.sendMail(test, mail);

		String strBetreff = "Re: " + testList.get(0).getBetreff();
		String strMailTo = testList.get(0).getFrom() + ", "
				+ testList.get(0).getToString();
		String content = "\n" + "\n" + testList.get(0).getText();

		System.out.println(strBetreff);
		System.out.println(strMailTo);
		System.out.println(content);

		new NewMailWindow(strMailTo, strBetreff, content);
	}
}
